function [beta] = compile_3d_beta_toolbox(patient);
    
    if patient.par_toolbox>0
        
        pctRunOnAll javaaddpath E:\ParforProgMonv2\java
        progressStepSize = 1;
        ppm = ParforProgMon('                        Lung: ',patient.dim(1),  progressStepSize,300, 80);
        
        parfor slice=1:patient.dim(1);
            
            %     display(sprintf('Slice %d',slice));
            beta_slice=load([patient.model_params_folder sprintf('/beta_%d',slice)]);
            beta_u(slice,:,:)=squeeze(beta_slice.data(:,:,1));
            beta_v(slice,:,:)=squeeze(beta_slice.data(:,:,2));
            beta_w(slice,:,:)=squeeze(beta_slice.data(:,:,3));
            
            %     beta_slice_vec=bsxfun(@hypot,squeeze(beta_slice.data(:,:,1)),bsxfun(@hypot,squeeze(beta_slice.data(:,:,2)),squeeze(alpha_slice.data(:,:,3))));
            %     beta_vec(slice,:,:)=beta_slice_vec;
            ppm.increment();
            
        end
    else
        for slice=1:patient.dim(1);
            
            %     display(sprintf('Slice %d',slice));
            beta_slice=load([patient.model_params_folder sprintf('/beta_%d',slice)]);
            beta_u(slice,:,:)=squeeze(beta_slice.data(:,:,1));
            beta_v(slice,:,:)=squeeze(beta_slice.data(:,:,2));
            beta_w(slice,:,:)=squeeze(beta_slice.data(:,:,3));
            
            %     beta_slice_vec=bsxfun(@hypot,squeeze(beta_slice.data(:,:,1)),bsxfun(@hypot,squeeze(beta_slice.data(:,:,2)),squeeze(alpha_slice.data(:,:,3))));
            %     beta_vec(slice,:,:)=beta_slice_vec;
            
            
        end
    end
    
    beta.u = beta_u;clear beta_u;
    beta.v = beta_v;clear beta_v;
    beta.w = beta_w;clear beta_w;
    
    save([patient.model_params_folder '/beta'], 'beta')
